<template>
  <div class="dashboard-container">
    <div class="dashboard-text">name: {{ name }}</div>
    <!-- 图标的使用 -->
    <!-- <svg-icon icon-class="dashboard" />
    <svg-icon icon-class="eye" />
    <svg-icon icon-class="eye-open" /> -->

    <!-- 展示图表 -->
    <!-- 3.必须提前准备好一个有宽高的容器 -->
    <div ref="box" class="box" style="width: 500px; height: 500px; background-color: pink;">
      123
    </div>
  </div>

</template>

<script>
// 1.下载
// 2.导入
import * as echarts from 'echarts'

console.log(666, echarts)
import { mapGetters } from 'vuex'

export default {
  name: 'Dashboard',
  computed: {
    ...mapGetters([
      'name'
    ])
  },
  created() {
    // 实例化echarts(需要用到的dom)
  },
  mounted() {
    // 4.实例化echarts(需要用到的dom)
    // echarts.init(document.querySelector('.box'))
    const myChart = echarts.init(this.$refs.box) // echarts实例
    // console.log(myChart)
    // 5.绘制图标 传入配置对象 描述图标的模样
    myChart.setOption({
      title: {
        text: '这是专门示例'
      },
      tooltip: {},
      xAxis: {
        data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '运动鞋', '袜子']
      },
      yAxis: {},
      series: [
        {
          name: '销量',
          type: 'bar',
          data: [5, 20, 36, 10, 100, 20]
        }
      ]
    })
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
